scoreboard objectives add biome_advancements_advertisments_show dummy
scoreboard objectives add biome_advancements_server_settings dummy
scoreboard objectives add biome_advancements_settings trigger
scoreboard objectives add biome_advancements_word_check dummy
scoreboard objectives add biome_advancements_have_settings dummy
scoreboard objectives add biome_advancements_settings_version dummy
scoreboard objectives add biome_advancements_advertisments_version dummy
scoreboard objectives add biome_advancements_show_toast dummy
scoreboard objectives add biome_advancements_show_color dummy
scoreboard objectives add biome_advancements_lock_advertisments_show dummy
scoreboard objectives add biome_advancements_lock_show_toast dummy
scoreboard objectives add biome_advancements_lock_show_color dummy
execute as @a run scoreboard players enable @s biome_advancements_settings

execute unless data storage biome_advancements:settings have_settings run data modify storage biome_advancements:settings have_settings set value true
execute unless data storage biome_advancements:settings settings_version run data modify storage biome_advancements:settings settings_version set value 7
execute unless data storage biome_advancements:settings advertisments_version run data modify storage biome_advancements:settings advertisments_version set value 4
execute unless data storage biome_advancements:settings word_check run data modify storage biome_advancements:settings word_check set value true
execute unless data storage biome_advancements:settings default_advertisments_show run data modify storage biome_advancements:settings default_advertisments_show set value true
execute unless data storage biome_advancements:settings default_show_toast run data modify storage biome_advancements:settings default_show_toast set value true
execute unless data storage biome_advancements:settings default_show_color run data modify storage biome_advancements:settings default_show_color set value true
execute unless data storage biome_advancements:settings lock_advertisments_show run data modify storage biome_advancements:settings lock_advertisments_show set value false
execute unless data storage biome_advancements:settings lock_show_toast run data modify storage biome_advancements:settings lock_show_toast set value false
execute unless data storage biome_advancements:settings lock_show_color run data modify storage biome_advancements:settings lock_show_color set value false

execute store result score @a biome_advancements_settings_version run data get storage biome_advancements:settings settings_version
execute store result score @a biome_advancements_advertisments_version run data get storage biome_advancements:settings advertisments_version
execute store result score @a biome_advancements_have_settings run data get storage biome_advancements:settings have_settings
execute store result score @a biome_advancements_word_check run data get storage biome_advancements:settings word_check
execute store result score @a biome_advancements_lock_advertisments_show run data get storage biome_advancements:settings lock_advertisments_show
execute store result score @a biome_advancements_lock_show_toast run data get storage biome_advancements:settings lock_show_toast
execute store result score @a biome_advancements_lock_show_color run data get storage biome_advancements:settings lock_show_color
execute as @a unless score @s biome_advancements_settings = @s biome_advancements_settings run scoreboard players set @s biome_advancements_settings 0
execute as @a unless score @s biome_advancements_show_color = @s biome_advancements_show_color store result score @s biome_advancements_show_color run data get storage biome_advancements:settings default_show_color
execute as @a unless score @s biome_advancements_advertisments_show = @s biome_advancements_advertisments_show store result score @s biome_advancements_advertisments_show run data get storage biome_advancements:settings default_advertisments_show
execute as @a unless score @s biome_advancements_show_toast = @s biome_advancements_show_toast store result score @s biome_advancements_show_toast run data get storage biome_advancements:settings default_show_toast

execute as @a if score @s biome_advancements_settings matches -100 run function biome_advancements:settings/acknowledgments_list
execute as @a if score @s biome_advancements_settings matches -101 run function biome_advancements:settings/download_url
execute as @a if score @s biome_advancements_settings matches -103 run function biome_advancements:settings/licence
execute as @a if score @s biome_advancements_settings matches 1 run function biome_advancements:settings/system_use
execute as @a if score @s biome_advancements_server_settings matches 1 run function biome_advancements:settings/server_settings
execute as @a if score @s biome_advancements_server_settings matches 2 run function biome_advancements:settings/default_settings
execute as @a if score @s biome_advancements_server_settings matches 3 run function biome_advancements:settings/settings_lock
execute as @a if score @s biome_advancements_settings matches 100 run function biome_advancements:settings/show_server_settings

execute as @a if score @s biome_advancements_settings matches 200..205 at @s run playsound ui.button.click block @s
execute as @a if score @s biome_advancements_settings matches 200 if score @s biome_advancements_lock_show_color matches 0 run scoreboard players set @s biome_advancements_show_color 1
execute as @a if score @s biome_advancements_settings matches 201 if score @s biome_advancements_lock_show_color matches 0 run scoreboard players set @s biome_advancements_show_color 0
execute as @a if score @s biome_advancements_settings matches 202 if score @s biome_advancements_lock_advertisments_show matches 0 run scoreboard players set @s biome_advancements_advertisments_show 1
execute as @a if score @s biome_advancements_settings matches 203 if score @s biome_advancements_lock_advertisments_show matches 0 run scoreboard players set @s biome_advancements_advertisments_show 0
execute as @a if score @s biome_advancements_settings matches 204 if score @s biome_advancements_lock_show_toast matches 0 run scoreboard players set @s biome_advancements_show_toast 1
execute as @a if score @s biome_advancements_settings matches 205 if score @s biome_advancements_lock_show_toast matches 0 run scoreboard players set @s biome_advancements_show_toast 0

execute as @a if score @s biome_advancements_settings matches 200 if score @s biome_advancements_lock_show_color matches 0 run playsound ui.button.click ambient @s
execute as @a if score @s biome_advancements_settings matches 201 if score @s biome_advancements_lock_show_color matches 0 run playsound ui.button.click ambient @s
execute as @a if score @s biome_advancements_settings matches 202 if score @s biome_advancements_lock_advertisments_show matches 0 run playsound ui.button.click ambient @s
execute as @a if score @s biome_advancements_settings matches 203 if score @s biome_advancements_lock_advertisments_show matches 0 run playsound ui.button.click ambient @s
execute as @a if score @s biome_advancements_settings matches 204 if score @s biome_advancements_lock_show_toast matches 0 run playsound ui.button.click ambient @s
execute as @a if score @s biome_advancements_settings matches 205 if score @s biome_advancements_lock_show_toast matches 0 run playsound ui.button.click ambient @s

execute as @a if score @s biome_advancements_settings matches 200 if score @s biome_advancements_lock_show_color matches 1 run playsound block.anvil.place ambient @s
execute as @a if score @s biome_advancements_settings matches 201 if score @s biome_advancements_lock_show_color matches 1 run playsound block.anvil.place ambient @s
execute as @a if score @s biome_advancements_settings matches 202 if score @s biome_advancements_lock_advertisments_show matches 1 run playsound block.anvil.place ambient @s
execute as @a if score @s biome_advancements_settings matches 203 if score @s biome_advancements_lock_advertisments_show matches 1 run playsound block.anvil.place ambient @s
execute as @a if score @s biome_advancements_settings matches 204 if score @s biome_advancements_lock_show_toast matches 1 run playsound block.anvil.place ambient @s
execute as @a if score @s biome_advancements_settings matches 205 if score @s biome_advancements_lock_show_toast matches 1 run playsound block.anvil.place ambient @s
execute as @a if score @s biome_advancements_settings matches 200..205 run scoreboard players set @s biome_advancements_settings 0